package org.moore.view;

import org.moore.utils.Data;

import javax.swing.*;
import java.awt.*;

// 游戏窗口面板类
public class GamePanel extends JPanel {
	// 定义布局管理器
    private static CardLayout cardLayout;
    // 定义主界面
    private static HomeLabel homeLabel;
    // 定义游戏界面
    private static GameLabel gameLabel;
    // 定义关卡界面
    private static LevelLabel levelLabel;

    public GamePanel() {
        // 设置布局管理器
        cardLayout = new CardLayout();
        this.setLayout(cardLayout);
        // 创建Label对象
        homeLabel = new HomeLabel();
        gameLabel = new GameLabel();
        levelLabel = new LevelLabel();
        // 设置图片
        homeLabel.setIcon(Data.GAME_IMAGEICON);
        // 将JLabel设置为JPanel的组件
        this.add(homeLabel,"home");
        this.add(levelLabel,"level");
        this.add(gameLabel,"game");
        // 使界面获得焦点
        this.requestFocusInWindow();
    }

    public static CardLayout getCardLayout() {
        return cardLayout;
    }

    public static HomeLabel getHomeLabel() {
        return homeLabel;
    }

    public static GameLabel getGameLabel() {
        return gameLabel;
    }

    public static LevelLabel getLevelLabel() {
        return levelLabel;
    }

}
